using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace PicAFlick.App
{
    public partial class ThumbnailImageDisplay : UserControl
    {
        public ThumbnailImageDisplay()
        {
            InitializeComponent();
        }

        public ThumbnailImageDisplay(PicAFlick.Domain.ImageDetails id)
        {

            InitializeComponent();

            this.ImageDetails = id;
        }
        private PicAFlick.Domain.ImageDetails _imageDetails;

        public PicAFlick.Domain.ImageDetails ImageDetails
        {
            get { return _imageDetails; }
            set
            {
                _imageDetails = value;
                if (_imageDetails != null)
                {
                    this.label1.Text = _imageDetails.FileName;
                    _imageDetails.OnThumbnailUpdated += new PicAFlick.Domain.ImageDetails.ThumbnailUpdatedHandler(_imageDetails_OnThumbnailUpdated);
                    this.pictureBox1.Image = _imageDetails.Thumbnail;
                }
            }
        }

        void _imageDetails_OnThumbnailUpdated(object sender, EventArgs e)
        {
            this.pictureBox1.Image = _imageDetails.Thumbnail;
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            ImageViewForm iv = new ImageViewForm(this.ImageDetails);
            iv.Show();

        }

    }
}
